package org.example.goods.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.entity.Goods;

@Mapper
public interface GoodsMapper {

    @Select("select * from t_goods where id = #{id}")
    Goods selectById(@Param("id") Long id);

    @Update("update t_goods set goods_stock = goods_stock - #{amount} where id = #{id}")
    void reduceGoodsStock(@Param("id") Long id, @Param("amount") Integer amount);
}
